cmake_minimum_required(VERSION 3.16)
project("ccodes")

set(CMAKE_C_STANDARD 11)

if (EXISTS /usr/local/bin/gcc)
    set(CMAKE_C_COMPILER "/usr/local/bin/gcc")
    set(CMAKE_CXX_COMPILER "/usr/local/bin/g++")
elseif(EXISTS /usr/bin/gcc)
    set(CMAKE_C_COMPILER "/usr/bin/gcc")
    set(CMAKE_CXX_COMPILER "/usr/bin/g++")
else()
    message(STATUS "没有编译器可用")
    return()
endif ()

# 单独测试代码
#add_library(files.so files.h files.c)

add_executable(print9x9 yangxiaoguo/test_print9x9.c  yangxiaoguo/print_9x9_table.h  yangxiaoguo/print_9x9_table.c)
add_executable(num_split yangxiaoguo/num_split.c yangxiaoguo/num_split.h)

add_executable(read basic/files.h basic/files.c unix/ipc_fifo.h unix/ipc_fifo.c unix/test_fifo_read.c)
add_executable(write basic/files.h basic/files.c unix/ipc_fifo.h unix/ipc_fifo.c unix/test_fifo_write.c)

add_executable(os_detect basic/os_detect.h basic/os_detect.c basic/os_test.c)